home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / cutAttachCurvesToolScript.me < prev    next >
Encoding:
Text File  |  2003-07-17  |  3.8 KB  |  137 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. // Alias|Wavefront Script File
  19. // MODIFY THIS AT YOUR OWN RISK
  20. //
  21. // Creation Date:  14 January 1999
  22. // Author:         sw
  23. //
  24. //
  25. //  Procedure Name:
  26. //      cutAttachCurvesToolScript
  27. //
  28. //  Description:
  29. //    create wrapper around the cutAttachCurves command
  30. //
  31. //  Input Arguments:
  32. //        0 ==> do the command.
  33. //        1 ==> show the action option box
  34. //        2 ==> return the command
  35. //        3 ==> show tool option box
  36. //        4 ==> enter the tool
  37. //
  38. //  Return Value:
  39. //      None.
  40. //
  41.  
  42. global proc cutAttachCurvesToolSetup( int $forceFactorySettings, string $goToTool )
  43. {
  44.     if( $forceFactorySettings || !`optionVar -ex cutAttachCurvesEuc` ) {
  45.         optionVar -iv cutAttachCurvesEuc 0;
  46.     }
  47.     if( $forceFactorySettings || !`optionVar -ex cutAttachCurvesLac` ) {
  48.         optionVar -iv cutAttachCurvesLac 1;
  49.     }
  50.     if( "" != $goToTool ) {
  51.         scriptCtx -e -euc `optionVar -q cutAttachCurvesEuc` $goToTool;
  52.         scriptCtx -e -lac `optionVar -q cutAttachCurvesLac` $goToTool;
  53.     }
  54. }
  55.  
  56. global proc cutAttachCurvesValues ( string $toolName ) 
  57. {
  58.     scriptCtxCommonValues( $toolName );
  59. }
  60.  
  61. global proc cutAttachCurvesProperties()
  62. {
  63.     scriptCtxCommonProperties;
  64. }
  65.  
  66. proc createCutAttachCurveContext( string $tool )
  67. {
  68.     if( ! `scriptCtx -exists $tool` ) {
  69.         cutAttachCurvesToolSetup( 0, "" );
  70.  
  71.         int $n = 0;
  72.         if( `optionVar -q cutAttachCurvesLac` ) {
  73.             $n = 2;
  74.         }
  75.  
  76.         scriptCtx -i1 "blank.xpm"
  77.             -title "Cut Attach Curves Tool"
  78. //            -bcn "cutCurves"
  79.  
  80.             -exitUponCompletion `optionVar -q cutAttachCurvesEuc`
  81.             -totalSelectionSets 1
  82.             -expandSelectionList true
  83.             -fcs ("cutAttachCurvesToolScript 0")
  84.  
  85.             -setNoSelectionPrompt ("Select two NURBS curves or points on " +
  86.                                    "curves for cuting and attaching.")
  87.             -setSelectionPrompt ("Select the second NURBS curve or a point " +
  88.                                  "on a NURBS curve to cut and attach." +
  89.                                  "Press ENTER to complete.")
  90.  
  91.             -setAutoToggleSelection true
  92.             -setAutoComplete `optionVar -q cutAttachCurvesLac`
  93.             -showManipulators true
  94.             -setSelectionCount $n
  95.  
  96.             -nurbsCurve true
  97.             -curveParameterPoint true
  98.             -editPoint true
  99.         $tool;
  100.     }
  101. }
  102.  
  103. global proc string cutAttachCurvesToolScript( int $setToTool )
  104. //
  105. //    Description :
  106. //        0 ==> do the command.
  107. //        1 ==> show the action option box
  108. //        2 ==> return the command
  109. //        3 ==> show tool/action option box
  110. //        4 ==> enter the tool/do the command        ONLY ALLOW THIS FOR NOW
  111. {
  112.     string $tool = "";
  113.     string $afterCut[];
  114.     int $n, $i;
  115.  
  116.     switch( $setToTool ) {
  117.       case 4:
  118.         $tool = "cutAttachCurveContext";
  119.         createCutAttachCurveContext $tool;
  120.         setToolTo $tool;
  121.         break;
  122.       case 0:
  123.       default:
  124.         cutCurvePreset(0,1,0.1,6,0,0,1,4,1);
  125.         $afterCut = `ls -sl`;
  126.         $n = size($afterCut);
  127.         for( $i=0; $i<$n; $i+=1 ) {
  128.             // Now, two of these are bad, two are OK:
  129.             if( `getAttr ($afterCut[$i] + ".spans")` < 1) delete $afterCut[$i];
  130.         }
  131.         doAttachCurveArgList( 2, { "0", "1", "1", "0", "0.5", "0", "0.1" } );
  132.         break;
  133.     }
  134.  
  135.     return "";
  136. }
  137.